package me.sdevil507.biz.fruit.po;

import lombok.Data;
import lombok.EqualsAndHashCode;
import me.sdevil507.supports.jpa.BaseJpaSnowflakeIdEntity;
import me.sdevil507.supports.upload.po.AttachFile;
import org.hibernate.annotations.Formula;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @program: tips_back_end
 * @description: 成果反馈信息过程
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "biz_fruit_feed_back")
@Where(clause="is_del = 0")
public class FruitFeedBackPO extends BaseJpaSnowflakeIdEntity {

    /**
     * 成果id
     */
    @Column
    private Long  fruitId;

    /**
     * 智库id
     */
    @Column
    private Long  orgId;

    /**
     * 来源机构
     */
    @Column
    private String sourceName;

    /**
     * 内容
     */
    @Column
    private String content;

    /**
     * 专报内容
     */
    @Column(columnDefinition = "text")
    @Lob
    private String bodyText;

    /**
     * 来源类型  1: 智库  2: 智库办
     */
    @Column
    private String type;

    /**
     * 是否查看
     */
    @Column
    private Boolean isLook;

    /**
     * 是否删除
     */
    @Column(nullable = false)
    private Boolean  isDel= false;

    /**
     * 创建时间
     */
    @Column
    private Date createTime = new Date();

    /**
     * 更新时间
     */
    @Column
    private Date updateTime = new Date();

    /**相关批示附件**/
    @OneToMany(targetEntity = AttachFile.class, cascade= CascadeType.MERGE, fetch = FetchType.LAZY, orphanRemoval = true)
    @JoinColumn(name="relationId")
    @org.hibernate.annotations.ForeignKey(name = "none")
    private List<AttachFile> attFiles =new ArrayList<>();

}
